-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement optional default for override_tag #125
Conversation
tests/templates/patterns/atoms/tags_test_atom/tags_test_atom.yaml
Outdated
Show resolved
Hide resolved
ec2ab0d
to
021300c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UNSPECIFIED
stuff looks good, just a couple of tweaks required for the docs and this will be ready to go.
docs/overview.md
Outdated
@@ -134,6 +134,21 @@ The override process has two parts: | |||
1. Override your template tag with a mock implementation | |||
2. Define fake result for your tag in a `yaml` file | |||
|
|||
|
|||
### Providing a default value for template tags | |||
To provide a default for a template tag, you need to provide a keyword argument default when overriding your tag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/default/default_html/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/overview.md
Outdated
This default is used for any tag that's not passed its own context, allowing specificity for those elements that need it while preventing the tag from breaking when it's not structural to the component. | ||
|
||
#### limitation | ||
Currently the default override is limited to direct references only i.e. {% a_tag_name page.url %} and not {% a_tag_name page.url as variable_name %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the wording here. What's actually not supported is modifying context, so it might be better to say something along the lines of "Only providing a default for the output of the tag is supporting, it's not possible to modify context like <example of simpletag as
>".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point, thanks.
Description
This PR provides away for a template tag to be provided a default value, across any template that is rendered. This default can be overridden in template specific context if desired so still allows for specific functionality when required.
Please include a summary of the changes and which issue this relates to (if applicable). Please list any dependencies that are required for this change.
Fixes # Request from feedback sheet.
Type of change
Please delete options that are not relevant.
Checklist: